<!DOCTYPE html>
<html lang="zh-CN"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>分类列表</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <!--<link th:href="@{css/bootstrap.min14ed.css}" rel="stylesheet">-->
    <!--<link th:href="@{css/plugins/dataTables/dataTables.bootstrap.css}" rel="stylesheet">-->
    <link rel="shortcut icon" th:href="@{favicon.ico}">
    <link th:href="@{css/font-awesome.min93e3.css}" rel="stylesheet">
    <link th:href="@{css/plugins/bootstrap-table/bootstrap-table.min.css}" rel="stylesheet">
    <link th:href="@{css/animate.min.css}" rel="stylesheet">
    <link th:href="@{css/style.min862f.css}" rel="stylesheet">
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>管理员 <small></small></h5><!--右上角图标-->
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="table_data_tables.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="table_data_tables.html#">选项1</a>
                            </li>
                            <li><a href="table_data_tables.html#">选项2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">

                    <table class="table table-striped table-bordered table-hover dataTables-example">
                        <thead>
                        <tr>
                            <!--<th>选中</th>-->
                            <th>分类ID</th>
                            <th>分类名称</th>
                            <th>上级ID</th>
                            <th>分类状态</th>
                            <th>排序</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr class="gradeX" th:each="classify:${classifyList}">
                            <!--<td><input type="checkbox"></td>-->
                            <td th:text="${classify.getClassId()}"></td>
                            <td th:text="${classify.getClassifyName()}"></td>
                            <td th:text="${classify.getUpperRankId()}" class="center"></td>
                            <td th:text="${classify.getClassStatus()}" class="center"></td>
                            <td th:text="${classify.getSort()}" class="center"></td>
                            <td class="center">
                                <a href="#">编辑</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a onclick="deleteClassify(this)" th:data="${classify.getClassId()}" href="#">删除</a>
                            </td>
                        </tr>
                        </tbody>
                    </table>

                </div>
            </div>
        </div>
    </div>
</div>
    <script th:src="@{js/plugins/jeditable/jquery.jeditable.js}"></script>
    <script th:src="@{js/plugins/dataTables/jquery.dataTables.js}"></script>
    <script th:src="@{js/plugins/dataTables/dataTables.bootstrap.js}"></script>
    <script th:src="@{js/content.min.js}"></script>

    <script th:src="@{js/jquery.min.js}"></script>
    <script th:src="@{js/bootstrap.min.js}"></script>
    <script th:src="@{js/content.min.js}"></script>
    <script th:src="@{js/plugins/bootstrap-table/bootstrap-table.min.js}"></script>
    <script th:src="@{js/plugins/bootstrap-table/bootstrap-table-mobile.min.js}"></script>
    <script th:src="@{js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js}"></script>
    <script th:src="@{js/demo/bootstrap-table-demo.min.js}"></script>
<script th:src="@{js/plugins/layer/layer.min.js}"></script>
    <!--<script th:src="@{http://tajs.qq.com/stats?sId=9051096}" charset="UTF-8"></script>-->

<script>
    function deleteClassify(obj) {
        var id=$(obj).attr("data");
        $.ajax({
            url: '/deleteClassify?classifyId='+id,
            type: 'post',
            dataType: 'json',
            contentType: 'application/json',
            // data: "classifyId="+id+"",
            async: false,
            success: function(data){
            if(data.data<0)
            {
                layer.msg(data.errorDetail);
                // layer.alert(data.errorDetail);
                return;
            }
            if(data.data>0)
            {
                // $(obj).remove();
                layer.msg(data.errorDetail, {
                    icon: 6, time: 1000, end: function (index, layero)
                    {
                        $(obj).parent().parent().remove();
                    }
                });
            }
        }
    });

    }
</script>
</body>

</html>
